import React from 'react';
import ReactDOM from 'react-dom/client';
import App from './App';
import reportWebVitals from './reportWebVitals';

//引入错误边界捕获的组件
import ErrorBoundary from './Error'

//引入AppProvider用于状态管理
import AppProvider from './AppProvider'

//引入路由的基本组件,这个相当于路由的'地基'

import { BrowserRouter as Router } from "react-router-dom"

const root = ReactDOM.createRoot(
  document.getElementById('root') as HTMLElement
);

root.render(
  <ErrorBoundary>
    <AppProvider>
      <Router>
        <App />
      </Router>
    </AppProvider>
  </ErrorBoundary>
);

// setInterval(() => {
//   root.render(
//     <App />
//   );
// }, 1000)


// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals();
